<template>
  <div class="MV">
    <!-- 导航栏 -->
    <navigation />
    <div class="container w">
      <div class="head">
        <ul>
          <div>全部</div>
          <li>大陆</li>
          <li>香港</li>
        </ul>

        <ul>
          <div>全部</div>
          <li>大陆</li>
          <li>香港</li>
        </ul>

        <ul>
          <div>全部</div>
          <li>大陆</li>
          <li>香港</li>
        </ul>
      </div>

      <ul class="box">
        <li
          v-for="(item, index) in MVlist"
          :key="index"
          @click="change(item.id)"
        >
          <div class="pic">
            <!-- 封面 -->
            <img :src="item.cover" alt="" />
            <!-- 播放量 -->
            <span class="el-icon-caret-right"> {{ item.playCount }}</span>
            <!-- 遮罩层 -->
            <div class="text">
              <!-- 名字 -->
              <div class="name">{{ item.artistName }}</div>
              <!-- 时间 -->
              <div class="time">{{ item.duration }}</div>
            </div>
            <i class="el-icon-video-play"></i>
          </div>
          <div class="names">{{ item.name }}</div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import navigation from "../../components/navigation/NaviGation";
import { MVlist } from "../../network/index";
export default {
  name: "MV",
  data() {
    return {
      MVlist: [],
    };
  },
  components: {
    navigation,
    MVlist,
  },
  created() {
    MVlist().then((res) => {
      if (res.data.code == "200") {
        this.MVlist = res.data.data;
        console.log(this.MVlist);
      }
    });
  },
  methods: {
    change(id) {
      this.$router.push({
        //核心语句
        path: "/mvdetail", //跳转的路径
        query: {
          //路由传参时push和query搭配使用 ，作用时传递参数
          id: id,
        },
      });
    },
  },
};
</script>

<style lang="less" scoped>
.MV {
  .container {
    margin-top: 110px;
    .head {
      ul {
        display: flex;
        margin-bottom: 15px;
        div {
          padding: 5px 10px;
          border-radius: 10px;
          font-size: 16px;
          color: #fff;
          font-weight: 700;
          background-color: #fa2800;
          margin-right: 10px;
        }
        li {
          padding: 5px 10px;
          font-size: 14px;
          color: #000;
        }
      }
    }
    .box {
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      li {
        max-width: 230px;
        height: 155px;
        padding: 15px 0;
        .pic {
          position: relative;
          img {
            width: 100%;
            height: 100%;
          }
          span {
            position: absolute;
            right: 10px;
            top: 10px;
            color: #fff;
            background-color: #000;
            font-size: 10px;
            padding: 3px;
            border-radius: 5px;
          }
          .text {
            display: flex;
            justify-content: space-between;
            position: absolute;
            height: 35px;
            width: 100%;
            font-size: 12px;
            font-weight: 700;
            bottom: 0;
            color: #fff;
            line-height: 35px;
            background-color: rgba(0, 0, 0, 0.5);
            .name {
              margin-left: 5px;
            }
            .time {
              margin-right: 5px;
            }
          }
          i {
            position: absolute;
            top: 42%;
            left: 45%;
            color: #fa2800;
            font-size: 36px;
          }
          .el-icon-video-play {
            display: none;
          }
        }
        .names {
          margin-top: 10px;
          font-size: 16px;
        }
      }
      li:hover .el-icon-video-play {
        display: block !important;
      }
    }
  }
}
</style>
